﻿using System;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for OccupationsDB
/// </summary>
/// 
namespace CE.Provider
{
    public class OccupationsDB
    {
        public OccupationsDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(Occupations occupations)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocPAOccupationsInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            #region Parameter

            _sPara.Add("@ProviderCompanyId", occupations.ProviderCompanyId);
            _sPara.Add("@CXOccupationId", occupations.CXOccupationId);
            _sPara.Add("@Description", occupations.Description);
            _sPara.Add("@Class", occupations.Class);
            _sPara.Add("@Status", occupations.Status);
            _sPara.Add("@RefCEUserId", occupations.RefCEUserId);
            _sPara.Add("@ViewedDetailId", occupations.ViewedDetailId);

            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetOccupationsList(Int64 ProviderCompanyId, Int16 ClassId)
        {
            MyDatabase _db = new MyDatabase();
            DataTable _dtResult = new DataTable();
            string _spName = "sprocPAOccupationsSelectItemList";
            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@ProviderCompanyId", ProviderCompanyId);
            _sPara.Add("@ClassId", ClassId);
            #endregion

            _dtResult = _db.GetDataTableBySP(_spName, _sPara);
            int i = _dtResult.Rows.Count;
            return _dtResult;
        }


    }
}